<?php
class systemTask{
	function buildTag(){
		global $dbs;
		$sql = 'SELECT * FROM `'. DB_PRE .'system_task` WHERE `id` = 1';
		$list = $dbs -> select($sql);
		$list = $list[0];
		$now = (int)date('Ymd',time());
		$bulidTime = (int)date('Ymd',strtotime($list['tagBuildTime'])) ;
		if( $now  >  $bulidTime  ){
			$tag = new tag();
			$tag -> buildRank($list['tagBuildNum']);
			$array['tagBuildTime'] = date('Y-m-d H:i:s',time());
			$dbs -> update(DB_PRE .'system_task', $array,'`id` = 1');
			unset( $tag );
		}
		unset($list);			
	}
	
	function saveFrontError(){
		include_once( ROOTPATH .'include'. DS .'browser.php');
		global $dbs;
		
		$browser = new Browser ;
		$array = array();
		$array['error']		= getQuery('error');
		$array['line'] 		= getQuery('line');
		$array['url'] 		= getQuery('url');
		$array['browser'] 	= $browser -> getBrowser();
		$array['version'] 	= $browser -> getVersion();
		$array['created'] 	= time();
		$array['ip'] 		= ip();
		$dbs -> insert(DB_PRE .'front_error',$array);
	}
}
?>